import Http, {HttpParamsProps} from "@/common/http";
import dayjs from "dayjs";


class EntityPaymentTrade {
    RowKey = "tradeNo"

    selectTablePage(props: HttpParamsProps): Promise<Response> {
        return Http.get("/api/trade/page", props)
    }

    selectStatisticsList(props: HttpParamsProps): Promise<Response> {
        const params = {...props.params}
        if (params["dates"]) {
            params["dates"] = params["dates"].map((p: any) => dayjs(p).format("YYYY-MM-DD"))
        }
        return Http.get("/api/statistics/list", {...props, params})
    }

}

// eslint-disable-next-line import/no-anonymous-default-export
export default new EntityPaymentTrade()